/**
 * Copyright 2009-2010 - YangJiandong(chunquedong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 你可以自由复制、传播本项目的下载包文件，但必须保持其完整性。
 * 我们不用对使用中的风险及由此造成的损失承担任何责任。
 * 详细情况请见《ChunMap许可协议》。

 * 想了解更多有关ChunMap的信息，请访问http://code.google.com/p/chunmap/
 */
package chunmap.model.crs;

/**
 * 椭球体
 * 
 * @author chunquedong
 * 
 */
public class Spheroid {
	private String name;
	private double a;
	private double b;
	private double e;
	private double e2;

	public Spheroid(String name, double a, double b) {
		super();
		
		if(a<b)throw new IllegalArgumentException("a must lagger then b");
		
		this.name = name;
		this.a = a;
		this.b = b;
		
		e=computeE();
		e2=computeE2();
	}

	public String getName() {
		return name;
	}

	public double getA() {
		return a;
	}

	public double getB() {
		return b;
	}

	public double getE() {
		return e;
	}
	
	public double getE2() {
		return e2;
	}

	private double computeE(){
		return Math.sqrt(1-Math.pow((b/a),2));
	}
	
	private double computeE2(){
		return Math.sqrt(Math.pow((a/b),2)-1);
	}
}
